 //
//  Zone.m
//  07 - MRCProvince
//
//  Created by 韩旭 on 16/7/12.
//  Copyright © 2016年 基础. All rights reserved.
//

#import "Zone.h"

@implementation Zone
- (void)dealloc {
    [_name release];
    [_cityNumber release];
    [super dealloc];
}
- (instancetype)initWithName:(NSString *)name {
    return [self initWithName:name cityNumber:nil];
}
+ (instancetype)provinceWithName:(NSString *)name {
    return [[[self alloc] initWithName:name] autorelease];
}
- (instancetype)initWithName:(NSString *)name cityNumber:(NSString *)cityNumber {
    self = [super init];
    if (self) {
      self.name = name;
      self.cityNumber = cityNumber;
    }
    return self;
}
+ (instancetype)provinceName:(NSString *)name cityNumber:(NSString *)cityNumber {
    return [[[self alloc] initWithName:name cityNumber:cityNumber] autorelease];
}

- (instancetype)initWithTempCity:(TempZone *)tempZone {
    return [self initWithName:tempZone.cityName cityNumber:tempZone.cityNumber];
}
+ (instancetype)zoneWithTempCity:(TempZone *)tempZone {
    return [[[self alloc] initWithTempCity:tempZone] autorelease];
}
- (NSString *)description {
    if (_cityNumber == nil) {
        return [NSString stringWithFormat:@"%@ ", _name ];
    } else {
        return [NSString stringWithFormat:@"%@ : %@", _name, _cityNumber];
    }
}

@end
